<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Bayesian Network: bn::cpt Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Bayesian Network
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><b>bn</b></li><li class="navelem"><a class="el" href="classbn_1_1cpt.html">cpt</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classbn_1_1cpt-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">bn::cpt Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>A wrapper class of <a class="el" href="classbn_1_1matrix.html" title="Provide a class representing dinamic N dimensions (N is equal to or greater than 1). ">bn::matrix</a> provides access methods to the CPT (Conditional Probability Table).  
 <a href="classbn_1_1cpt.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="cpt_8hpp_source.html">cpt.hpp</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:a93813a8dec56236ee4b0c4675b93cfa8"><td class="memItemLeft" align="right" valign="top"><a id="a93813a8dec56236ee4b0c4675b93cfa8"></a>
using&#160;</td><td class="memItemRight" valign="bottom"><b>rv_ptr</b> = component::random_variable_ptr</td></tr>
<tr class="separator:a93813a8dec56236ee4b0c4675b93cfa8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aada70f2ec7e3f35abdcb8f1759ebfdc0"><td class="memItemLeft" align="right" valign="top"><a id="aada70f2ec7e3f35abdcb8f1759ebfdc0"></a>
using&#160;</td><td class="memItemRight" valign="bottom"><b>matrix_type</b> = <a class="el" href="classbn_1_1matrix.html">matrix</a>&lt; std::vector&lt; double &gt; &gt;</td></tr>
<tr class="separator:aada70f2ec7e3f35abdcb8f1759ebfdc0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a946586ec4f0e23d62db6148ea670ec40"><td class="memItemLeft" align="right" valign="top"><a id="a946586ec4f0e23d62db6148ea670ec40"></a>
using&#160;</td><td class="memItemRight" valign="bottom"><b>condition_type</b> = std::unordered_map&lt; rv_ptr, std::size_t &gt;</td></tr>
<tr class="separator:a946586ec4f0e23d62db6148ea670ec40"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a58fdfe1f84fad252a8ab6f1a859bf243"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbn_1_1cpt.html#a58fdfe1f84fad252a8ab6f1a859bf243">cpt</a> (rv_ptr const &amp;<a class="el" href="classbn_1_1cpt.html#a03d8950f94fe2738ad2812846d4c0a84">rv</a>)</td></tr>
<tr class="memdesc:a58fdfe1f84fad252a8ab6f1a859bf243"><td class="mdescLeft">&#160;</td><td class="mdescRight">(ctor) Initialize CPT by random variable.  <a href="#a58fdfe1f84fad252a8ab6f1a859bf243">More...</a><br /></td></tr>
<tr class="separator:a58fdfe1f84fad252a8ab6f1a859bf243"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a88f060dddaf78715a39846c4083f1edf"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbn_1_1cpt.html#a88f060dddaf78715a39846c4083f1edf">cpt</a> (rv_ptr const &amp;<a class="el" href="classbn_1_1cpt.html#a03d8950f94fe2738ad2812846d4c0a84">rv</a>, std::vector&lt; rv_ptr &gt; const &amp;<a class="el" href="classbn_1_1cpt.html#ad089a05c56e9b6fca9b418d6a5a1934c">parents</a>)</td></tr>
<tr class="memdesc:a88f060dddaf78715a39846c4083f1edf"><td class="mdescLeft">&#160;</td><td class="mdescRight">(ctor) Initialize CPT by node and parent (conditional) node list  <a href="#a88f060dddaf78715a39846c4083f1edf">More...</a><br /></td></tr>
<tr class="separator:a88f060dddaf78715a39846c4083f1edf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6543249e9a1fe5ce044996b9e7f73ece"><td class="memItemLeft" align="right" valign="top"><a id="a6543249e9a1fe5ce044996b9e7f73ece"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbn_1_1cpt.html#a6543249e9a1fe5ce044996b9e7f73ece">cpt</a> (<a class="el" href="classbn_1_1cpt.html">cpt</a> const &amp;other)</td></tr>
<tr class="memdesc:a6543249e9a1fe5ce044996b9e7f73ece"><td class="mdescLeft">&#160;</td><td class="mdescRight">(Copy ctor) <br /></td></tr>
<tr class="separator:a6543249e9a1fe5ce044996b9e7f73ece"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afbccb3e93eb13b24099fcdd4a4af32f2"><td class="memItemLeft" align="right" valign="top"><a id="afbccb3e93eb13b24099fcdd4a4af32f2"></a>
virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbn_1_1cpt.html#afbccb3e93eb13b24099fcdd4a4af32f2">~cpt</a> ()</td></tr>
<tr class="memdesc:afbccb3e93eb13b24099fcdd4a4af32f2"><td class="mdescLeft">&#160;</td><td class="mdescRight">(Default dtor) <br /></td></tr>
<tr class="separator:afbccb3e93eb13b24099fcdd4a4af32f2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae5fe3c2f5f6398ba02d543dd946ba9e3"><td class="memItemLeft" align="right" valign="top"><a id="ae5fe3c2f5f6398ba02d543dd946ba9e3"></a>
<a class="el" href="classbn_1_1cpt.html">cpt</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbn_1_1cpt.html#ae5fe3c2f5f6398ba02d543dd946ba9e3">operator=</a> (<a class="el" href="classbn_1_1cpt.html">cpt</a> const &amp;other)</td></tr>
<tr class="memdesc:ae5fe3c2f5f6398ba02d543dd946ba9e3"><td class="mdescLeft">&#160;</td><td class="mdescRight">(Copy assignment) <br /></td></tr>
<tr class="separator:ae5fe3c2f5f6398ba02d543dd946ba9e3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae8651cbb4c5e6ffd12e2c6817f200450"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbn_1_1cpt.html#ae8651cbb4c5e6ffd12e2c6817f200450">reset</a> (std::vector&lt; rv_ptr &gt; <a class="el" href="classbn_1_1cpt.html#ad089a05c56e9b6fca9b418d6a5a1934c">parents</a>)</td></tr>
<tr class="memdesc:ae8651cbb4c5e6ffd12e2c6817f200450"><td class="mdescLeft">&#160;</td><td class="mdescRight">Change parent (conditional) nodes and reset.  <a href="#ae8651cbb4c5e6ffd12e2c6817f200450">More...</a><br /></td></tr>
<tr class="separator:ae8651cbb4c5e6ffd12e2c6817f200450"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab561a7d4b7aee7b6b674695bf5212780"><td class="memItemLeft" align="right" valign="top">matrix_type::element_type &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbn_1_1cpt.html#ab561a7d4b7aee7b6b674695bf5212780">at</a> (condition_type const &amp;condition)</td></tr>
<tr class="memdesc:ab561a7d4b7aee7b6b674695bf5212780"><td class="mdescLeft">&#160;</td><td class="mdescRight">Access to probability list by condition r.v. list.  <a href="#ab561a7d4b7aee7b6b674695bf5212780">More...</a><br /></td></tr>
<tr class="separator:ab561a7d4b7aee7b6b674695bf5212780"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a30a4012c2deaa0d3ab795e564fd16d95"><td class="memItemLeft" align="right" valign="top">matrix_type::element_type const  &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbn_1_1cpt.html#a30a4012c2deaa0d3ab795e564fd16d95">at</a> (condition_type const &amp;condition) const</td></tr>
<tr class="memdesc:a30a4012c2deaa0d3ab795e564fd16d95"><td class="mdescLeft">&#160;</td><td class="mdescRight">Access to probability list by condition r.v. list (const version).  <a href="#a30a4012c2deaa0d3ab795e564fd16d95">More...</a><br /></td></tr>
<tr class="separator:a30a4012c2deaa0d3ab795e564fd16d95"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4e5ae968e96043ce5b37077ec071bcfe"><td class="memItemLeft" align="right" valign="top">matrix_type::element_type &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbn_1_1cpt.html#a4e5ae968e96043ce5b37077ec071bcfe">operator[]</a> (condition_type const &amp;condition)</td></tr>
<tr class="memdesc:a4e5ae968e96043ce5b37077ec071bcfe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Access to probability list by condition r.v. list.  <a href="#a4e5ae968e96043ce5b37077ec071bcfe">More...</a><br /></td></tr>
<tr class="separator:a4e5ae968e96043ce5b37077ec071bcfe"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a90b08e643cbcd1c030e69771b30b308a"><td class="memItemLeft" align="right" valign="top">matrix_type::element_type const  &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbn_1_1cpt.html#a90b08e643cbcd1c030e69771b30b308a">operator[]</a> (condition_type const &amp;condition) const</td></tr>
<tr class="memdesc:a90b08e643cbcd1c030e69771b30b308a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Access to probability list by condition r.v. list (const version).  <a href="#a90b08e643cbcd1c030e69771b30b308a">More...</a><br /></td></tr>
<tr class="separator:a90b08e643cbcd1c030e69771b30b308a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a03d8950f94fe2738ad2812846d4c0a84"><td class="memItemLeft" align="right" valign="top">rv_ptr const  &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbn_1_1cpt.html#a03d8950f94fe2738ad2812846d4c0a84">rv</a> () const noexcept</td></tr>
<tr class="memdesc:a03d8950f94fe2738ad2812846d4c0a84"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the target random variable of this instance.  <a href="#a03d8950f94fe2738ad2812846d4c0a84">More...</a><br /></td></tr>
<tr class="separator:a03d8950f94fe2738ad2812846d4c0a84"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad089a05c56e9b6fca9b418d6a5a1934c"><td class="memItemLeft" align="right" valign="top">std::vector&lt; rv_ptr &gt; const  &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbn_1_1cpt.html#ad089a05c56e9b6fca9b418d6a5a1934c">parents</a> () const noexcept</td></tr>
<tr class="memdesc:ad089a05c56e9b6fca9b418d6a5a1934c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the parent random variables of the target.  <a href="#ad089a05c56e9b6fca9b418d6a5a1934c">More...</a><br /></td></tr>
<tr class="separator:ad089a05c56e9b6fca9b418d6a5a1934c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1e5ffeaddbac53651afbbe782170de6d"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbn_1_1cpt.html#a1e5ffeaddbac53651afbbe782170de6d">is_valid</a> (condition_type const &amp;condition) const noexcept</td></tr>
<tr class="memdesc:a1e5ffeaddbac53651afbbe782170de6d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Verify whether given condition is sufficient in this instance.  <a href="#a1e5ffeaddbac53651afbbe782170de6d">More...</a><br /></td></tr>
<tr class="separator:a1e5ffeaddbac53651afbbe782170de6d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9340fe9dcd844e997d3779aa21fbb6c9"><td class="memItemLeft" align="right" valign="top">std::vector&lt; std::size_t &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbn_1_1cpt.html#a9340fe9dcd844e997d3779aa21fbb6c9">condition_to_index</a> (condition_type const &amp;condition) const</td></tr>
<tr class="memdesc:a9340fe9dcd844e997d3779aa21fbb6c9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Convert condition of conditional r.v. into access list of matrix.  <a href="#a9340fe9dcd844e997d3779aa21fbb6c9">More...</a><br /></td></tr>
<tr class="separator:a9340fe9dcd844e997d3779aa21fbb6c9"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A wrapper class of <a class="el" href="classbn_1_1matrix.html" title="Provide a class representing dinamic N dimensions (N is equal to or greater than 1). ">bn::matrix</a> provides access methods to the CPT (Conditional Probability Table). </p>
<p>The CPT is a collection of probabilities for a identical node. Whenever given r.v.(Random Variable) list, list is regarded Conditional nodes and it return probabilities.</p>
<p>Example: when cpt::condition_type cond = {{node1, 2}, {node2, 5}}; cpt cpt(node3, {node1, node2});</p>
<p>and std::vector&lt;double&gt; probabilities = cpt[cond];</p>
<p>then P(node3=0 | node1=2, node2=5): probabilities[0] P(node3=1 | node1=2, node2=5): probabilities[1] : : P(node3=n | node1=2, node2=5): probabilities[n] </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a58fdfe1f84fad252a8ab6f1a859bf243"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a58fdfe1f84fad252a8ab6f1a859bf243">&#9670;&nbsp;</a></span>cpt() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bn::cpt::cpt </td>
          <td>(</td>
          <td class="paramtype">rv_ptr const &amp;&#160;</td>
          <td class="paramname"><em>rv</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">explicit</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>(ctor) Initialize CPT by random variable. </p>
<p>Initialization is performed for only argument random variable. The random variable cannot be changed.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">rv</td><td>a random variable which represents a target of generated instance. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a88f060dddaf78715a39846c4083f1edf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a88f060dddaf78715a39846c4083f1edf">&#9670;&nbsp;</a></span>cpt() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bn::cpt::cpt </td>
          <td>(</td>
          <td class="paramtype">rv_ptr const &amp;&#160;</td>
          <td class="paramname"><em>rv</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::vector&lt; rv_ptr &gt; const &amp;&#160;</td>
          <td class="paramname"><em>parents</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>(ctor) Initialize CPT by node and parent (conditional) node list </p>
<p>Initialization is performed for only argument random variab which cannot be changed, and generate a condition matrix corresponding to parent nodes in arguments.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">rv</td><td>a random variable which represents a target of generated instance. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">parants</td><td>a set of random variables corresponding to parent (conditional) nodes of the first argument rv. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="ab561a7d4b7aee7b6b674695bf5212780"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab561a7d4b7aee7b6b674695bf5212780">&#9670;&nbsp;</a></span>at() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">matrix_type::element_type&amp; bn::cpt::at </td>
          <td>(</td>
          <td class="paramtype">condition_type const &amp;&#160;</td>
          <td class="paramname"><em>condition</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Access to probability list by condition r.v. list. </p>
<p>if condition is invalid, then throw std::runtime_error.</p>
<dl class="section return"><dt>Returns</dt><dd>an 1-dimensional probability array corresponding to P(X_Q | X_E1 = x_e1, ..., X_EN = x_en). </dd></dl>

</div>
</div>
<a id="a30a4012c2deaa0d3ab795e564fd16d95"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a30a4012c2deaa0d3ab795e564fd16d95">&#9670;&nbsp;</a></span>at() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">matrix_type::element_type const&amp; bn::cpt::at </td>
          <td>(</td>
          <td class="paramtype">condition_type const &amp;&#160;</td>
          <td class="paramname"><em>condition</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Access to probability list by condition r.v. list (const version). </p>
<p>if condition is invalid then throw std::runtime_error.</p>
<dl class="section return"><dt>Returns</dt><dd>an 1-dimensional probability array corresponding to P(X_Q | X_E1 = x_e1, ..., X_EN = x_en). </dd></dl>

</div>
</div>
<a id="a9340fe9dcd844e997d3779aa21fbb6c9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9340fe9dcd844e997d3779aa21fbb6c9">&#9670;&nbsp;</a></span>condition_to_index()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::vector&lt;std::size_t&gt; bn::cpt::condition_to_index </td>
          <td>(</td>
          <td class="paramtype">condition_type const &amp;&#160;</td>
          <td class="paramname"><em>condition</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Convert condition of conditional r.v. into access list of matrix. </p>
<p>std::out_of_range is thown if the condition does not contain any parent nodes' value. std::runtime_error is thown if any parent nodes' value which is contained in the condition exceeds its max value. No exceptions are thrown if is_valid(condition) is true.</p>
<dl class="section return"><dt>Returns</dt><dd>an array of index in implementation of class cpt. </dd></dl>

</div>
</div>
<a id="a1e5ffeaddbac53651afbbe782170de6d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1e5ffeaddbac53651afbbe782170de6d">&#9670;&nbsp;</a></span>is_valid()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool bn::cpt::is_valid </td>
          <td>(</td>
          <td class="paramtype">condition_type const &amp;&#160;</td>
          <td class="paramname"><em>condition</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Verify whether given condition is sufficient in this instance. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">condition</td><td>a set of pairs corresponding to the observed (evidence) nodes (environment). </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if condition is valid for this cpt instance, false if index is invalid. </dd></dl>

</div>
</div>
<a id="a4e5ae968e96043ce5b37077ec071bcfe"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4e5ae968e96043ce5b37077ec071bcfe">&#9670;&nbsp;</a></span>operator[]() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">matrix_type::element_type&amp; bn::cpt::operator[] </td>
          <td>(</td>
          <td class="paramtype">condition_type const &amp;&#160;</td>
          <td class="paramname"><em>condition</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Access to probability list by condition r.v. list. </p>
<p>if condition is invalid, then throw std::runtime_error.</p>
<dl class="section return"><dt>Returns</dt><dd>an 1-dimensional probability array corresponding to P(X_Q | X_E1 = x_e1, ..., X_EN = x_en). </dd></dl>

</div>
</div>
<a id="a90b08e643cbcd1c030e69771b30b308a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a90b08e643cbcd1c030e69771b30b308a">&#9670;&nbsp;</a></span>operator[]() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">matrix_type::element_type const&amp; bn::cpt::operator[] </td>
          <td>(</td>
          <td class="paramtype">condition_type const &amp;&#160;</td>
          <td class="paramname"><em>condition</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Access to probability list by condition r.v. list (const version). </p>
<p>if condition is invalid then throw std::runtime_error.</p>
<dl class="section return"><dt>Returns</dt><dd>an 1-dimensional probability array corresponding to P(X_Q | X_E1 = x_e1, ..., X_EN = x_en). </dd></dl>

</div>
</div>
<a id="ad089a05c56e9b6fca9b418d6a5a1934c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad089a05c56e9b6fca9b418d6a5a1934c">&#9670;&nbsp;</a></span>parents()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::vector&lt;rv_ptr&gt; const&amp; bn::cpt::parents </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get the parent random variables of the target. </p>
<dl class="section return"><dt>Returns</dt><dd>a array of random variables which are parents in this cpt instance. </dd></dl>

</div>
</div>
<a id="ae8651cbb4c5e6ffd12e2c6817f200450"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae8651cbb4c5e6ffd12e2c6817f200450">&#9670;&nbsp;</a></span>reset()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void bn::cpt::reset </td>
          <td>(</td>
          <td class="paramtype">std::vector&lt; rv_ptr &gt;&#160;</td>
          <td class="paramname"><em>parents</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Change parent (conditional) nodes and reset. </p>
<p>Strong guarantee: if an exception is thrown, there are no changes in the CPT. </p>

</div>
</div>
<a id="a03d8950f94fe2738ad2812846d4c0a84"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a03d8950f94fe2738ad2812846d4c0a84">&#9670;&nbsp;</a></span>rv()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">rv_ptr const&amp; bn::cpt::rv </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get the target random variable of this instance. </p>
<dl class="section return"><dt>Returns</dt><dd>a random variable corresponding to this cpt instance. </dd></dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>bayesian/<a class="el" href="cpt_8hpp_source.html">cpt.hpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>
